import request from '@/utils/request'

export function getRoleList(data) {
  return request({
    url: '/role/getRoleList',
    method: 'get',
    params: data
  })
}

export function createRole(data) {
  return request({
    url: '/role/createRole',
    method: 'post',
    data
  })
}
export function delRole(id) {
  return request({
    url: '/role/delRole/' + id,
    method: 'delete'
  })
}
export function updateRole(data) {
  return request({
    url: '/role/updateRole',
    method: 'put',
    data
  })
}
export function userAddRole(data) {
  return request({
    url: '/role/userAddRole',
    method: 'post',
    data
  })
}
// 关联权限
export function getRoleLinkList() {
  return request({
    url: '/role/getPermissions',
    method: 'get'
  })
}
export function getRoleLinktree() {
  return request({
    url: '/role/permissions/tree',
    method: 'get'
  })
}
export function getRoleLinkIdList(id) {
  return request({
    url: '/role/permissions/' + id,
    method: 'get'
  })
}
export function getRoleLinkAdd(id, data) {
  return request({
    url: '/role/addPermissions/' + id,
    method: 'post',
    data
  })
}
